<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html lang="zh-ch">
<head>
<meta charset="utf-8">
<title>简洛订餐系统-通知管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<jsp:include page="/WEB-INF/views/inc/inc.jsp"></jsp:include>
</head>
<body style="zoom: 1;">
	<jsp:include page="/WEB-INF/views/inc/Header.jsp"></jsp:include>
	<jsp:include page="/WEB-INF/views/inc/Inc01.jsp"></jsp:include>
	<div class="container" style="margin-top: 5px;">

		<div class="row border">
			<div class="col-xs-12 btn-group-xs"
				style="padding-left: 10px; padding-top: 5px; padding-bottom: 5px; border-bottom: solid 1px #ccc;">
				<button type="button" class="button bg-main button-small dialogs" data-toggle="click"  data-mask="1" data-width="20%"
					data-target="#addUserModal"><span class="icon-plus text-white"></span> 添加</button>
				<button type="button" class="button bg-main button-small" id="deleteBut" ><span class="icon-trash-o text-white"></span> 删除</button>
			</div>
			<div class="col-xs-12 " style="margin: 0px;">
                <form action="DeleteSymNotice.nut" method="post" id="tableForm">
				<table class="table table-striped">
					<thead>
						<tr>
							<th width="5%"></th>
							<th width="10%">标题</th>
							<th width="50%">内容</th>
							<th width="20%">发布人</th>
							<th width="15%">发布时间</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="user" items="${obj}">
							<tr>
								<td>
								    <label class="checkbox" for="checkbox1" style="margin: 5px;"> 
								       <input type="checkbox" name="snids" data-toggle="checkbox" value="${user.snid }">
									</label>
								</td>
								<td>${user.sntitle }</td>
								<td>${user.sncontent }</td>
								<td>${user.userName }</td>
								<td>${user.sntime }</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
                </form>
			</div>
		</div>
	</div>


	<!-- Add User Modal -->
	<div id="addUserModal" >
	   <div class="dialog fadein-top">
            <div class="dialog-head">
                <span class="close rotate-hover "></span>
                <strong>新增通知</strong>
            </div>
            <form class="form form-block" action="AddNotice.nut" method="post">
	            <div class="dialog-body">
                    <div class="login-form" id="login">
                    
                        <c:if test="${flag == '1'}">
                           <div class="alert alert-green"><span class="close rotate-hover"></span>密码更新成功。</div>
                        </c:if>
                        <div class="form-group" style="margin: 10px 0px; " >
                            <div class="label"><label class="addon" for="oldpassword">标题：</label></div> 
                            <div class="field">
                                <input
                                    type="text" class="input radius-none" 
                                    id="sntitle" name="sntitle" data-validate="required:通知标题不能为空" placeholder="请输入标题"/>
                            </div>
                        </div>
                        <div class="form-group" style="margin: 10px 0px; " >
                            <div class="label"><label class="addon" for="newPassWord">内容：</label></div> 
                            <div class="field">
                                <textarea rows="5" class="input" id="sncontent" name="sncontent" data-validate="required:通知内容不能为空" placeholder="请输入内容"></textarea>
                            </div>
                        </div>
                    </div>
	            </div>
	            <div class="dialog-foot">
	                <button type="button" class="button dialog-close" data-dismiss="modal">关闭</button>
	                <button type="submit" id="userSubmitBut" class="button bg-green dialogs" >提交</button>
	            </div>
            </form>
		</div>
    </div>
	<!-- / Add User dialog -->
	
	<script type="text/javascript">
	$(function(){
		$("#deleteBut").click(function(){
			
			var selectedValue = $('input[name="snids"]').filter(':checked');
			if (selectedValue.length == 0) {
                var dialog = art.dialog({
                    lock: true,
                    background: '#000', // 背景色
                    opacity: 0.2,  // 透明度
                    title: '警告',
                    content: '请选择要删除的通知！',
                    icon: 'warning',
                    ok: true
                });
                return;
            } else {
				var dialog = art.dialog({
	                lock: true,
	                background: '#000', // 背景色
	                opacity: 0.2,  // 透明度
	                title: '警告',
	                content: '请确认是否删除通知！',
	                icon: 'question',
	                ok: function(){$("#tableForm").submit();},
	                cancelVal: '关闭',
	                cancel: true //为true等价于function(){}
	            });
            	
            }
		});
	});
	
	</script>
</body>
</html>